cmake_minimum_required(VERSION 3.22)
project(qtc_alarm LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC OFF)
set(CMAKE_AUTORCC OFF)

option(ENABLE_KAFKA "Build Kafka consumer module" ON)
option(ENABLE_REST "Build REST client module" ON)
option(ENABLE_PERSIST "Build persistence module" ON)

find_package(Qt6 6.9 REQUIRED COMPONENTS Core Network)

if(ENABLE_KAFKA)
  find_package(PkgConfig REQUIRED)
  pkg_check_modules(RDKAFKA REQUIRED IMPORTED_TARGET rdkafka)
endif()

add_subdirectory(qtc_alarm_core)
if(ENABLE_KAFKA)
  add_subdirectory(qtc_alarm_kafka)
endif()
if(ENABLE_PERSIST)
  add_subdirectory(qtc_alarm_persist)
endif()
if(ENABLE_REST)
  add_subdirectory(qtc_alarm_rest)
endif()
add_subdirectory(examples/alarm_demo)
